package com.ch.playandroid.activity

import androidx.activity.viewModels
import com.alibaba.android.arouter.facade.annotation.Route
import com.ch.common.base.activity.BaseActivity
import com.ch.common.constant.ConstantValue
import com.ch.movie.MovieFragment
import com.ch.playandroid.R
import com.ch.playandroid.adapter.setFragmentAdapter
import com.ch.playandroid.constants.TAB_MAIN_BOTTOM_BJNEWS
import com.ch.playandroid.constants.TAB_MAIN_BOTTOM_HOMEPAGE
import com.ch.playandroid.constants.TAB_MAIN_BOTTOM_PROJECT
import com.ch.playandroid.constants.TAB_MAIN_BOTTOM_SYSTEM
import com.ch.playandroid.databinding.ActivityAppBinding
import com.ch.playandroid.fragment.*
import com.ch.playandroid.viewmodel.AppViewModel
class AppActivity : BaseActivity<AppViewModel, ActivityAppBinding>() {
    override val viewModel: AppViewModel by viewModels()

    override fun getLayoutResID(): Int {
        return R.layout.activity_app
    }

    override fun initView() {

        mBinding.vpMain.setFragmentAdapter(this) {
            count(5)
            createFragment { position ->
                when (position) {
                    TAB_MAIN_BOTTOM_HOMEPAGE -> AppFragment()
                    TAB_MAIN_BOTTOM_SYSTEM -> SysterFragment()
                    TAB_MAIN_BOTTOM_BJNEWS -> NewsFragment()
                    TAB_MAIN_BOTTOM_PROJECT -> ProjectFragment()
                    else -> MovieFragment()
                }
            }
        }
    }

    override fun initObserve() {
    }

    override fun bindViewModel() {
        mBinding.viewModel = viewModel
    }

}